<template>
    <v-table
            :searchFlag="false"
            :hasEdit="false"
            :pageSize="pageSize"
            :page="page"
            :tableConfig="tableConfig"
            :tableData="tableData"
            :total="total"
            @findData="getTableData"
            @getTableData="getTableData"
            @searhData="setSearhData"
            @selectData="setSelectData"
            @upData="getTableData"
            ref="table"
    ></v-table>
</template>

<script>
    import table from 'commons/Table'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "Table",
        mixins: [baseMixin],
        props: {
            data: {
                type: Object
            }
        },
        data() {
            return {
                tableConfig: [
                    {
                        label: this.$t('config.shipper'),
                        prop: "storerkey",
                        input: "input",
                    },
                    {
                        label: this.$t('out.externalorderkey2'),
                        prop: "orderkey",
                        input: "input",
                    },
                  {
                    label: this.$t('out.externorderkey'),
                    prop: "externorderkey",
                    input: "input",
                  },
                  {
                    label: this.$t('wave.rtxtxno'),
                    prop: "rtxtxno",
                    input: "input",
                  },
                  {
                    label: this.$t('out.rtxshopname'),
                    prop: "rtxshopname",
                    input: "input",
                  },
                  {
                    label: this.$t('in.podate1'),
                    prop: "orderdate",
                    input: "date",
                  },
                  {
                    label: this.$t('out.originalqty'),
                    prop: "totalqty",
                    input: "input",
                    disabled: true
                  },
                  {
                    label: this.$t('wave.totalorderlines'),
                    prop: "totalorderlines",
                    input: "input",
                    disabled: true
                  },
                  {
                    label: this.$t('config.carrierCode'),
                    prop: "carriercode",
                    input: "input",
                  },
                  {
                    label: this.$t('out.rtxbuyermsg'),
                    prop: "rtxbuyermsg",
                    input: "input",
                  },
                  {
                    label: this.$t('out.contact1'),
                    prop: "c_contact1",
                    input: "input",
                  },
                  {
                    label: this.$t('config.phone'),
                    prop: "c_phone2",
                    input: "input",
                  },
                  {
                    label: this.$t('out.c_city'),
                    prop: "c_city",
                    input: "input",
                  },
                  {
                    label: this.$t('out.rtxcancelmark'),
                    prop: "rtxcancelmark",
                    input: "input",
                  },
                ],
                tableData: [],
                pageSize: 10,
              page: 1,
                total: 10,
                searhData: {}
            }
        },
        methods: {
            //获取table数据
            async getTableData(page, data) {
                let str = ""
                if (this.$route.query.queryPageFlag === "querybulider") {
                    str = this.data.argument.interactionid
                } else {
                    str = this.data.argument.filterid
                }
                try {
                    let res = await this.$api.post(`/showOrdersList/${str}/${this.data.argument.rtxwavetype}/${this.$route.query.queryPageFlag}/${page}/${this.data.argument.orderNumber}/${this.data.argument.orderQty}/${this.data.argument.rtxexternaltype}`,this.data.argument);
                    
                        this.loading = false;
                        this.tableData = res.page.list;
                      this.page = res.page.curpage;
                        this.pageSize = res.page.pageSize;
                        this.total = res.page.total;
                    
                } catch (e) {
                    this.$message.error(e);
                }
            },
            //搜索值
            setSearhData(data, up) {
                if (!up) {
                    this.searhData = data;
                } else {
                    this.searhData = data;
                    this.getTableData(1, this.searhData);
                }
            },
            //选中的数据
            setSelectData(data) {
                this.$parent.setSelectData(data)
            },
        },
        mounted() {
            this.getTableData(1, {})
        },
        components: {
            'v-table': table
        }
    }
</script>

<style scoped>

</style>
